package com.mobimap.nhom9.dao.table;

import android.database.Cursor;

import com.mobimap.nhom9.dto.LocationDTO;
import com.mobimap.nhom9.dto.PlaceExDTO;
import com.mobimap.nhom9.dto.PlaceExType;

public class AddressTable implements IOneKeyTable<PlaceExDTO> {
	public static final String[] columns = new String[] { "ID", "Number",
			"Area", "xLocation", "yLocation" };

	public String getName() {
		return "Address";
	}

	public String[] getColumns() {

		return columns;
	}

	public PlaceExDTO cusorToDTO(Cursor cursor) {
		PlaceExDTO dto = new PlaceExDTO();
		dto.setPlaceExType(PlaceExType.ADDRESS);
		dto.setId(cursor.getInt(0));
		dto.setNumber(cursor.getString(1));
		dto.setArea(cursor.getString(2));
		LocationDTO location = new LocationDTO();
		location.setLatitude(cursor.getFloat(3));
		location.setLongitude(cursor.getFloat(4));
		dto.setLocation(location);
		return dto;
	}

	public String getColumnKey() {
		
		return "ID";
	}

}
